#!/usr/bin/python
# -*- encoding: utf-8 -*-
#
# Copyright (C) 2008 Håvard Gulldahl.
#
# Licensed under the GNU Public License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.gnu.org/licenses/gpl-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__author__ = u'<havard@gulldahl.no> Håvard Gulldahl'
__license__ = 'GPL v2'

from PyQt4 import QtGui,  QtCore


class PasswordDialog(QtGui.QDialog):
  def __init__(self):
    QtGui.QDialog.__init__(self)
    self.setObjectName("Gmail username and password")
    
    self.layout1=QtGui.QHBoxLayout()
    self.layout2=QtGui.QHBoxLayout()
    self.layout=QtGui.QVBoxLayout(self)

    self.userLabel=QtGui.QLabel("gmail &username", self)
    self.user=QtGui.QLineEdit(self)
    self.userLabel.setBuddy(self.user)
    self.layout1.addWidget(self.userLabel)
    self.layout1.addWidget(self.user)

    self.passwLabel=QtGui.QLabel("gmail &password", self)
    self.password=QtGui.QLineEdit(self)
    self.passwLabel.setBuddy(self.password)

    self.layout2.addWidget(self.passwLabel)
    self.layout2.addWidget(self.password)

    self.layout.addLayout(self.layout1)
    self.layout.addLayout(self.layout2)

    self.buttonBox = QtGui.QDialogButtonBox(self)
    self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
    self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok)
    self.buttonBox.setObjectName("buttonBox")

    QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),self.accept)
    QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),self.reject)
    QtCore.QMetaObject.connectSlotsByName(self)
    self.layout.addWidget(self.buttonBox)

class ConflictDialog(QtGui.QDialog):
  def __init__(self):
    QtGui.QDialog.__init__(self)
    self.setObjectName("Contact Conflict")
    
    self.conflictLayout=QtGui.QHBoxLayout()
    self.layout=QtGui.QVBoxLayout(self)

    self.contact1Label=QtGui.QLabel("xxxxx", self)
    self.conflictLayout.addWidget(self.contact1Label)

    self.contact2Label=QtGui.QLabel("xxxxxx", self)
    self.conflictLayout.addWidget(self.contact2Label)

    self.textLabel=QtGui.QLabel(u"A contact using this email address already exists. Press OK to update the user on the left with values from the right.", self)
    self.layout.addWidget(self.textLabel)
    
    self.layout.addLayout(self.conflictLayout)

    self.buttonBox = QtGui.QDialogButtonBox(self)
    self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
    self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok)
    self.buttonBox.setObjectName("buttonBox")

    QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),self.accept)
    QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),self.reject)
    QtCore.QMetaObject.connectSlotsByName(self)
    self.layout.addWidget(self.buttonBox)
    
